package com.peng.device.controller;

import com.peng.device.pojo.dto.DeviceAddParam;
import com.peng.pojo.StationInfoVO;
import com.peng.device.service.DeviceService;
import com.peng.pojo.param.GunStatusUpdateParam;
import com.peng.web.JsonResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 设备服务控制器
 * @author： Peng
 * @date： 2024/6/24
 * @version: 1.0
 */
@RestController
@RequestMapping("/device")
@Slf4j
@Api(tags = "设备场站相关接口")
public class DeviceController {
    @Autowired
    private DeviceService deviceService;

    @PostMapping("/create")
    @ApiOperation("新增设备")
    public JsonResult addDevice(DeviceAddParam deviceAddParam) {
        log.debug("addDevice: {}", deviceAddParam);
//        deviceService.addDevice(deviceAddParam);
        return null;
    }

    @GetMapping("/station/info/{gunId}")
    @ApiOperation("获取场站信息")
    public JsonResult getStationInfo(@PathVariable("gunId") Integer gunId) {
        log.debug("获取场站信息: 参数{}", gunId);
        StationInfoVO stationInfoVO = new StationInfoVO();
        stationInfoVO.setStationId(1);
        stationInfoVO.setOperatorId(1);
        return JsonResult.ok(stationInfoVO,"获取场站信息成功");
    }

    @ApiOperation("更新枪的状态")
    @PostMapping("/station/gun/status/update")
    public JsonResult updateGunStatus(@RequestBody GunStatusUpdateParam gunStatusUpdateParam) {
        log.debug("更新枪的状态-{}",gunStatusUpdateParam);
        return JsonResult.ok(true);
    }
}
